/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package by.vdl.websort.server.dao;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author zeor
 */
public class BaseDao {

    @Autowired
    protected SessionFactory sessionFactory;

    public void setSessionFactory(SessionFactory sessionFactory) {
        this.sessionFactory = sessionFactory;
    }

    protected Map<String, ?> getParameters(Object ... params){
        Map<String, Object> map = new HashMap<String, Object>();
        if((params.length%2) != 0)
            return map;
        for(int i=0; i<params.length; i=i+2){
            map.put((String)params[i], params[(i+1)]);
        }
        return map;
    }
}
